package com.songcha.module_home.ui.decoration

import android.graphics.Rect
import android.view.View
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.songcha.library_common.util.dp2px

class HomeHomeEditorRecommendItemDecoration:RecyclerView.ItemDecoration() {
    override fun getItemOffsets(
        outRect: Rect,
        view: View,
        parent: RecyclerView,
        state: RecyclerView.State
    ) {
        val layoutParams: GridLayoutManager.LayoutParams =
            view.layoutParams as GridLayoutManager.LayoutParams

        outRect.bottom=19f.dp2px().toInt()

        if(layoutParams.spanIndex%3==0){
            //outRect.left=18.dp2px()
           /* outRect.left=18.dp2px()
            outRect.top=0f.dp2px().toInt()
            outRect.right=0f.dp2px().toInt()
            outRect.bottom=19f.dp2px().toInt()*/
        }else if(layoutParams.spanIndex%3==1){
            //outRect.left=2.dp2px()
            //outRect.right=2.dp2px()
           /* outRect.left=(0).dp2px()
            outRect.top=0f.dp2px().toInt()
            outRect.right=(0).dp2px()
            outRect.bottom=19f.dp2px().toInt()*/
        }else if(layoutParams.spanIndex%3==2){
            //outRect.right=18.dp2px()
           /* outRect.left=0.dp2px()
            outRect.top=0f.dp2px().toInt()
            outRect.right=18f.dp2px().toInt()
            outRect.bottom=19f.dp2px().toInt()*/
        }

    }
}